1. Field of the Invention
The present invention relates to a gradation converting device, a gradation converting method, and a computer program, and, more particularly to a gradation converting device, a gradation converting method, and a computer program that can realize, for example, a reduction in size and a reduction in cost of the device.
2. Description of the Related Art
For example, to display an image of an N-bit pixel value (hereinafter also referred to as N-bit image) in a display device that displays an image of an M-bit pixel value smaller than the N-bit pixel value, it is necessary to convert the N-bit image into the M-bit image, i.e., perform gradation conversion for converting the gradation of the image.
As a method of gradation-converting the N-bit image into the M-bit image (a gradation converting method), for example, there is a method of omitting lower N-M bits of the N-bit pixel value to convert the N-bit pixel value into the M-bit pixel value.
The gradation converting method for omitting the lower N-M bits of the N-bit pixel value and converting the N-bit pixel value into the M-bit pixel value is explained below with reference to FIGS. 1A and 1B and FIGS. 2A and 2B.
FIGS. 1A and 1B are diagrams of an 8-bit image of a gray scale and a pixel value on a certain horizontal line of the image.
FIG. 1A is a diagram of the 8-bit image of the gray scale.
In the image shown in FIG. 1A, pixel values gradually change from 100 to 200 from the left to the right in the horizontal direction. The same pixel values are arranged in the vertical direction.
FIG. 1B is a diagram of a pixel value on a certain horizontal line of the image shown in FIG. 1A.
In FIG. 1A, a pixel value at the left end is 100 and pixel values are larger further on the right side. A pixel value at the right end is 200.
FIGS. 2A and 2B are diagrams of a 4-bit image formed by omitting lower 4 bits of the 8-bit image shown in FIG. 1A and a pixel value on a certain horizontal line of the image.
FIG. 2A is a diagram of an image formed by quantizing the 8-bit image shown in FIG. 1A into 4 bits by omitting the lower 4 bits of the 8-bit image. FIG. 2B is a diagram of a pixel value on a certain horizontal line of the image.
256 (=28) gradations can be represented by 8 bits. However, only 16 (=24) bits can be represented by 4 bits. Therefore, in the gradation conversion for omitting the lower 4 bits of the 8-bit image, banding in which a change in gradations looks like a band occurs.
There are a random dither method, an ordered dither method, and an error diffusion method as a gradation converting method for preventing such banding from occurring and simulatively representing the gradation of an image before the gradation conversion in an image after the gradation conversion, i.e., for example, a method of visually representing, in a 16-gradation image obtained by gradation-converting a 256-gradation image as explained above, 256 gradations in 16 gradations when a person looks at the image.
FIGS. 3A and 3B are diagrams for explaining the random dither method.
FIG. 3A is a diagram of a configuration example of a gradation converting device in the past that performs gradation conversion by the random dither method. FIG. 3B is a diagram of an image of a gray scale obtained by the gradation conversion by the gradation converting device shown in FIG. 3A.
In FIG. 3A, the gradation converting device includes an arithmetic unit 11, a random-noise output unit 12, and a quantizing unit 13.
For example, a pixel value IN(x,y) of each pixel (x,y) of an 8-bit image is supplied to the arithmetic unit 11 in raster scan order as an image to be subjected to the gradation conversion (an image before the gradation conversion). The pixel (x,y) represents a pixel xth from the left and yth from the top.
Random noise outputted from the random-noise output unit 12, which generates and outputs random noise, is also supplied to the arithmetic unit 11.
The arithmetic unit 11 adds up the pixel value IN(x,y) and the random noise outputted from the random-noise output unit 12 and supplies an added-up value obtained as a result of the addition to the quantizing unit 13.
The quantizing unit 13 quantizes the added-up value supplied from the arithmetic unit 11 into, for example, 4 bits and outputs a 4-bit quantized value obtained as a result of the quantization as a pixel value OUT(x,y) of the pixel (x,y) of an image after the gradation conversion.
In the random dither method, the configuration of the gradation converting device is simplified. However, since the random noise is added to the pixel value IN(x,y), noise is conspicuous in the image after the gradation conversion as shown in FIG. 3B. Therefore, it is difficult to obtain a high-quality image.
FIGS. 4A and 4B are diagrams for explaining the ordered dither method.
FIG. 4A is a diagram of a configuration example of a gradation converting device in the past that performs gradation conversion by the ordered dither method. FIG. 4B is a diagram of an image of a gray scale obtained by the gradation conversion by the gradation converting device shown in FIG. 4A.
In FIG. 4A, the gradation converting device includes an arithmetic unit 21 and a quantizing unit 22.
For example, a pixel value IN(x,y) of each pixel (x,y) of an 8-bit image is supplied to the arithmetic unit 21 in raster scan order as an image to be subjected to the gradation conversion.
A dither matrix is also supplied to the arithmetic unit 21.
The arithmetic unit 21 adds up the pixel value IN(x,y) and a value of a random matrix corresponding to a position (x,y) of the pixel (x,y) having the pixel value IN(x,y) and supplies an added-up value obtained as a result of the addition to the quantizing unit 22.
The quantizing unit 22 quantizes the added-up value supplied from the arithmetic unit 21 into, for example, 4 bits and outputs a 4-bit quantized value obtained as a result of the quantization as a pixel value OUT(x,y) of a pixel (x,y) of an image after the gradation conversion.
With the ordered dither method, compared with the random dither method, it is possible to improve a quality of the image after the gradation conversion. However, as shown in FIG. 4B, a pattern of the dither matrix may appear in the image after the gradation conversion.
FIGS. 5A and 5B are diagrams for explaining the error diffusion method.
FIG. 5A is a diagram of a configuration example of a gradation converting device in the past that performs gradation conversion by the error diffusion method. FIG. 5B is a diagram of an image of a gray scale obtained by the gradation conversion by the gradation converting device shown in FIG. 5A.
In FIG. 5A, the gradation converting device includes an arithmetic unit 31, a quantizing unit 32, an arithmetic unit 33, and a two-dimensional filter 34.
For example, a pixel value IN(x,y) of each pixel (x,y) of an 8-bit image is supplied to the arithmetic unit 31 in raster scan order as an image to be subjected to the gradation conversion.
An output of the two-dimensional filter 34 is supplied to the arithmetic unit 31.
The arithmetic unit 31 adds up the pixel value IN(x,y) and the output of the two-dimensional filter 34 and supplies an added-up value obtained as a result of the addition to the quantizing unit 32 and the arithmetic unit 33.
The quantizing unit 32 quantizes the added-up value supplied from the arithmetic unit 31 into, for example, 4 bits and outputs a 4-bit quantized value obtained as a result of the quantization as a pixel value OUT(x,y) of the pixel (x,y) of an image after the gradation conversion.
The pixel value OUT(x,y) outputted by the quantizing unit 32 is supplied to the arithmetic unit 33 as well.
The arithmetic unit 33 subtracts the pixel value OUT(x,y) supplied from the quantizing unit 32 from the added-up value supplied from the arithmetic unit 31, i.e., subtracts the output from the quantizing unit 32 from the input to the quantizing unit 32 to calculate a quantization error −Q(x,y) caused by the quantization in the quantizing unit 32. The arithmetic unit 33 supplies the quantization error −Q(x,y) to the two-dimensional filter 34.
The two-dimensional filter 34 is a two-dimensional filter for filtering a signal. The two-dimensional filter 34 filters the quantization error −Q(x,y) supplied from the arithmetic unit 33 and outputs a result of the filtering to the arithmetic unit 31.
The arithmetic unit 31 adds up the result of the filtering of the quantization error −Q(x,y) outputted by the two-dimensional filter 34 as explained above and the pixel value IN(x,y).
In the gradation converting device shown in FIG. 5A, the quantization error −Q(x,y) is fed back to the input side (the arithmetic unit 31) via the two-dimensional filter 34. The gradation converting device configures a two-dimensional ΔΣ modulator.
With the two-dimensional ΔΣ modulator explained above, the quantization error −Q(x,y) is diffused to a high-frequency band of a spatial frequency in both the horizontal direction (the x direction) and the vertical direction (the y direction) (noise shaping). As a result, as shown in FIG. 5B, as an image after the gradation conversion, a high-quality image can be obtained compared with those obtained by the random noise method and the ordered dither method.
A method of performing gradation conversion into a high-quality image using the two-dimensional ΔΣ modulator is disclosed in detail in Japanese Patent No. 3959698.